Android automatically exits the FM Radio application when the flight mode is enabled and the headset is pulled out.
The FM radio needs to be inserted into the headset as an antenna, and automatically exits when the headset is pulled out.
1. First add the prompt string
Mediatek/packages/apps/FMRadio/res/values/strings. xml
The FM will close because you have been plug out the headphone
The FM will close because you have been entered the airplane mode
2. Modify
Customer requirements
After the headset is pulled out during FM playback, The FM app displays a prompt box Indicating "unplug the headset and stop the FM", and then automatically close
Modify fmradioservice. Java1. Add the following import to display the toast
/// AAAAA add start
Import Android. widget. Toast;
/// AAAAA add endpublic class fmradioservice extends Service implements fmrecorder. onrecordersta
After the customer asks the FM to unplug the headset during playback, the fm app displays a prompt box Indicating "unplug the headset and stop the Fm", and then automatically closes
Modify FMRadioService. java1. Add the following import to display the toast/// AAAAA add startImport android. widget. Toast;/// AAAAA add endPublic class FMRadioService extends Service implements FMRecorder. OnRecorderStateChang
The FM radio needs to be plugged into the headset as an antenna and automatically exits when the headset is unplugged1. First add a hint stringMediatek/packages/apps/fmradio/res/values/strings.xml2.Modify FmradioserviceMediatek/packages/apps/fmradio/src/com/mediatek/fmradio/fmradioservice.java ---a/mediatek/packages/apps/fmradio/src/com/mediatek/fmradio/fmradioservice.java+++ b/mediatek/packages/apps/ fmradio/src/com/mediatek/fmradio/fmradioservice.java@@ -227,6 +227,34 @@ public class
A while ago briefly described some of the FM open, recording and search process, analysis of the various types of source code, the next is to close the FM, the study of the FM module is over, I hope that the finishing can be in the FM in the understanding of some help, If you have encountered a problem or bug when modifying the upper layer code of the FM module, you can leave a message and we will deal with it together.FM off in two ways, one is to unplug the headset, FM off, and the other is to
1. Modify FMRadioService. java
Add:
Copy codeThe Code is as follows: public static final int MSG_EXIT_FM = 1234;
Private Handler sHandler11 = new Handler (){
@ Override
Public void handleMessage (Message msg ){
FMRadioLogUtils. d (TAG, "sHandler11 =" + msg. what );
Switch (msg. what ){
Case MSG_EXIT_FM:
Android. OS. Process. killProcess (android. OS. Process. myPid ());
Break;
}
}
};
2. Modify the onReceive Method InSwitchAntennaAsync (m
Contact Us
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.